package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.entity.Result;
import com.itheima.pojo.CheckItem;
import com.itheima.service.CheckItemService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 检查项管理
 */


@RestController
@RequestMapping("/checkitem")
public class CheckItemController {
    @Reference//查找CheckItem checkItem这个服务
    private CheckItem checkItem;

    //    新增检查项
    @RequestMapping("/add")
    public Result add(@RequestBody CheckItem checkItem) {
//    调用add()方法，把checkItem对象传进去
        try {
            CheckItemService.add(checkItem);

        } catch (Exception e) {
            e.printStackTrace();
//            服务调用失败
            return new Result(false,"新增检查项失败");


        }
        return null;

    }
}
